﻿using Gateway.Common.Enums;

namespace Gateway.Common.Entity
{
    public class EntityWithOperatorStatusBase : EntityWithOperatorBase
    {
        /// <summary>
        /// 是否禁用
        /// </summary>
        public BooleanStatusEnum? Disabled { get; private set; } = BooleanStatusEnum.No;

        /// <summary>
        /// 是否删除
        /// </summary>
        public BooleanStatusEnum? Deleted { get; private set; } = BooleanStatusEnum.No;

        #region 实体操作

        /// <summary>
        /// 删除
        /// </summary>
        public virtual void SetDeleted()
        {
            Deleted = BooleanStatusEnum.Yes;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="statusEnum"></param>
        /// <param name="operatorId"></param>
        /// <param name="operatorName"></param>
        public virtual void SetDeleted(BooleanStatusEnum? statusEnum, string operatorId, string operatorName)
        {
            Deleted = statusEnum;
            SetModifier(operatorId,operatorName);
        }

        /// <summary>
        /// 禁用
        /// </summary>
        /// <param name="disable"></param>
        public virtual void SetDisabled(string disable)
        {
            Disabled = BooleanStatusEnum.FromValue(disable);
        }

        /// <summary>
        /// 禁用
        /// </summary>
        /// <param name="statusEnum"></param>
        /// <param name="operatorId"></param>
        /// <param name="operatorName"></param>
        public virtual void SetDisabled(string statusEnum, string operatorId, string operatorName)
        {
            Disabled = BooleanStatusEnum.FromValue(statusEnum);
            SetModifier(operatorId,operatorName);
        }

        #endregion
    }
}